package com.example.demo.Service.Impl;

import com.example.demo.Service.ReaderService;
import com.example.demo.mapper.ReaderMapper;
import com.example.demo.model.Book;
import com.example.demo.model.Borrow;
import com.example.demo.model.Reader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReaderServiceImpl implements ReaderService {
    @Autowired
    ReaderMapper readerMapper;
    @Override
    public Reader  findReader(Integer reader_id){
        Reader reader = readerMapper.findReader(reader_id);
        return reader;
    };
    @Override
    public Integer  modifyReader(Reader reader){
        Integer result = readerMapper.modifyReader(reader);
        return result;
    };
    @Override
    public Book queryBook(String book_name){
        Book book = readerMapper.queryBook(book_name);
        return book;
    };

    @Override
    public List<Borrow> queryBorrow(Integer reader_id){
        List<Borrow> borrow = readerMapper.queryBorrow(reader_id);
        return borrow;
    };

    @Override
    public  List<Reader> getReaderList(){
        List<Reader> readerList = readerMapper.getReaderList();
        return readerList;
    }

    @Override
    public Integer addReader(Reader reader) {
        Integer result = readerMapper.addReader(reader);
        return result;
    }

    @Override
    public Integer deleteReader(Integer reader_id) {
        Integer result = readerMapper.deleteReader(reader_id);
        return result;
    }

}
